package ua.com.abakumov.android.prostopleer.tasks;

import android.os.AsyncTask;

/**
 * The same as AsyncTask but with ability to set a callback handler
 *
 * @author alexander-abakumov
 *         Date: 15.05.12
 * @see AsyncTask
 */
public abstract class AsyncTaskWithCallback<Params, Progress, Result> extends AsyncTask<Params, Progress, Result> {

    private final Done<Result> resultDone;

    /**
     * @param resultDone callback handler that invokes when result is computed
     */
    public AsyncTaskWithCallback(Done<Result> resultDone) {
        this.resultDone = resultDone;
    }

    @Override
    protected void onPostExecute(Result result) {
        //super.onPostExecute(result);
        resultDone.done(result);
    }
}